﻿<Page x:Class="MoreEPG.View.ChannelsView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d"
        d:DesignHeight="400"
        d:DesignWidth="550"
        DataContext="{Binding ChannelsViewModel, Source={StaticResource Locator}}">
    <Page.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Skins/Theme.xaml" />
                <ResourceDictionary Source="/Skins/MainSkin.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Page.Resources>
    <Border x:Name="Border2" Grid.Column="1" Margin="3" BorderBrush="GhostWhite" BorderThickness="1" CornerRadius="10">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="0.4*"></RowDefinition>
                <RowDefinition Height="4*"></RowDefinition>
                <RowDefinition Height="0.6*"></RowDefinition>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="5" Content="Channel Settings :" FontSize="12" HorizontalAlignment="Left" Foreground="White">
                <Label.Effect>
                    <DropShadowEffect></DropShadowEffect>
                </Label.Effect>
            </Label>
            <DataGrid ItemsSource="{Binding Items}" 
                      SelectedItem="{Binding Current}"
                      Grid.Column="0" 
                      Grid.Row="1" 
                      Margin="10" 
                      VerticalAlignment="Top"
                      AutoGenerateColumns="False" 
                      CanUserReorderColumns="False" 
                      CanUserResizeColumns="False" 
                      CanUserSortColumns="True"
                      AlternatingRowBackground="{DynamicResource GlassBrush}"
                      CanUserAddRows="False"
                      CanUserDeleteRows="False"
                      >
                <DataGrid.Resources>
                    <ResourceDictionary Source="/Skins/DataGridStyle.xaml" ></ResourceDictionary>
                </DataGrid.Resources>
                <DataGrid.Columns>
                    <DataGridCheckBoxColumn Width="50" Header="Active" Binding="{Binding Active}"></DataGridCheckBoxColumn>
                    <DataGridTextColumn Width="150" Header="Source Channel" Binding="{Binding Channel}" IsReadOnly="True"></DataGridTextColumn>
                    <DataGridTemplateColumn Width="100" Header="Logo">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                                    <Image Source="{Binding URL}" 
                                           Width="42" 
                                           Height="42" 
                                           Margin="1"
                                           VerticalAlignment="Center"></Image>
                                    <Button   Margin="3,0,0,0"
                                              Height="15" 
                                              ToolTip="Ändern"
                                              Width="22" 
                                              Content=";;;" 
                                              HorizontalAlignment="Right"
                                              VerticalAlignment="Center" 
                                              Command="{Binding Source={StaticResource Locator}, Path=Main.NewURL}"/>
                                </StackPanel>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTemplateColumn Width="150" Header="MC Channel">
                        <DataGridTemplateColumn.CellEditingTemplate>
                            <DataTemplate>
                                <ComboBox Height="25" VerticalAlignment="Center" SelectedItem="{Binding Service}" ItemsSource="{Binding Source={StaticResource Locator}, Path=Main.ComboItems}"></ComboBox>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellEditingTemplate>
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock VerticalAlignment="Center" Text="{Binding Service}"></TextBlock>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridCheckBoxColumn Header="HDTV" Binding="{Binding isHDTV}"></DataGridCheckBoxColumn>
                </DataGrid.Columns>
            </DataGrid>
            <StackPanel Grid.Row="2" Orientation="Horizontal">
                <Button Content="Save" 
                        Command="{Binding Save}" 
                        Margin="10,0,0,0" 
                        Width="60" 
                        Height="25">
                </Button>
                <Button Content="Reset" 
                        Command="{Binding Reset}" 
                        Margin="10,0,0,0" 
                        Width="60" 
                        Height="25">
                </Button>
                <Button Content="Next" 
                        Command="{Binding Next}" 
                        Margin="40,0,0,0" 
                        Width="60" 
                        Height="25">
                </Button>
                
            </StackPanel>
        </Grid>
    </Border>
</Page>
